package com.example.leo.mycharmingstudent.a0914;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Leo on 2020/9/14.
 */

public class StudentEntityParcelable implements Parcelable{
    public String name;
    public String sex;

    public StudentEntityParcelable(){}

    protected StudentEntityParcelable(Parcel in) {
        //此处的顺序需要和成员变量定义的顺序保持一致
        name = in.readString();
        sex = in.readString();
    }

    public static final Creator<StudentEntityParcelable> CREATOR = new Creator<StudentEntityParcelable>() {
        @Override
        public StudentEntityParcelable createFromParcel(Parcel in) {
            return new StudentEntityParcelable(in);
        }

        @Override
        public StudentEntityParcelable[] newArray(int size) {
            return new StudentEntityParcelable[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(sex);
    }
}
